home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / gold / toadClass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  10.0 KB  |  333 lines

  1. /*
  2.  * The original copyright owners of the accompanying source code files have
  3.  * agreed to place such code into the public domain.  Accordingly, anyone
  4.  * who receives or obtains a copy of such source code is freely entitled to
  5.  * reproduce, use and otherwise exploit such code (including the right to
  6.  * make derivative works), at his/her own risk and expense, without any
  7.  * obligation or liability to the original copyright owners.
  8.  *
  9.  * We would appreciate (but do not require) that the following message be
  10.  * included in any derivative works:
  11.  *
  12.  * "Portions of this program were developed by Peter Broadwell, Rob Myers
  13.  * and Robin Schaufler while working in Silicon Valley."
  14.  *
  15.  * The accompanying source code files and related documentation materials
  16.  * are distributed on an "AS IS" basis, without any warranties or
  17.  * guarantees of any kind.  All implied warranties, including the implied
  18.  * warranties of merchantability and of fitness for any particular purpose,
  19.  * are expressly disclaimed.
  20.  */
  21. #include "gl.h"
  22. #include "geom.h"
  23. #include "selectors.h"
  24. #include "class.h"
  25. #include "classIds.h"
  26. #include "mbox.h"
  27. #include "individual.h"
  28. #include "behavior.h"
  29. #include "doers.h"
  30.  
  31. #include "toad.h"
  32. #include "colors.h"
  33.  
  34. extern class indivClass;
  35. model toadStone;
  36. model toadTop;
  37. extern char *toadinit();
  38.  
  39. fcnTable toadTable[] = {
  40.     INIT,    toadinit,
  41.     EOTABLE,
  42. };
  43.  
  44. class toadClass = {
  45.     &indivClass,
  46.     toadTable,
  47.     sizeof(toad),
  48.     TOAD,
  49. };
  50.  
  51. toad toadTemplate = {
  52.             /*   inst        */
  53.     &toadClass,        /* myClass pointer    */
  54.     NULL,        /* classFunctions     */
  55.     0,            /* nFunctions        */
  56.             /*   mailbox        */
  57.     NULL,        /* subscribers          */
  58.     NULL,        /* subscribedTo         */
  59.             /*   individual        */
  60.     {0,0,-500},    /* position        */
  61.     {0,0,0},        /* lastPosition        */
  62.     {1,0,0},        /* delta        */
  63.     {0,0,0},        /* velocity        */
  64.     {0,0,0},        /* avelocity        */
  65.     {0,0,0},        /* acceleration        */
  66.     1.0,        /* speed        */
  67.     {0,0,10},        /* heading        */
  68.     {0,700,700},        /* rotation        */
  69.     {0,0,0},        /* influence        */
  70.     1.0,        /* scale                */
  71.     &toadStone,        /* model        */
  72.     NULL,        /* flags        */
  73.     NULL,        /* curVars        */
  74.     NULL,        /* controls        */
  75.             /*    toad        */
  76.     40.0,            /* size */
  77. };
  78.  
  79. long toadStoneVertices[] = {
  80.     0,0,
  81. };
  82.  
  83. model toadStone = {
  84.     &toadTop,            /* next model segment          */
  85.     0,            /* child model segments        */
  86.     0,                /* geometry compiled yet?      */
  87.     0,                /* compiled geometry object Id */
  88.     NULL,            /* point dictionary            */
  89.     toadStoneVertices,        /* polygon descriptions        */
  90.     { 0,0,0},            /* centroid                    */
  91.     TOADSTONE_COLOR,        /* color                       */
  92.     TOADSTONE_TEXTURE,        /* texture                     */
  93.     FALSE,            /* outlined                    */
  94.     {400,700,700},            /* rotation                */
  95.     {0,0,0},            /* translate                */
  96.     {1.0,1.0,1.0},        /* scale                */
  97.     0,                /* declasse               */
  98. };
  99.  
  100. point toadBodyPoints[] = {
  101.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  102.     {  000,  000,  990, },
  103.     { -500,  000,  850, },
  104.     { -500, -100,  850, },
  105.     {  000, -400,  770, },
  106.     {  990, -100,  750, },    /* pnt 5 */
  107.     {  990,  000,  750, },
  108.     {  990,  100,  750, },
  109.     {  000,  400,  770, },
  110.     { -500,  100,  850, },
  111.     { -470,  190,  850, },    /* pnt 10 */
  112.     { -200,  300,  450, },
  113.     {  300,  260,  440, },
  114.     {  900,   90,  650, },
  115.     {  900,  -90,  650, },
  116.     {  300, -260,  440, },
  117.     { -200, -300,  450, },
  118.     { -470, -190,  850, },
  119. };
  120.  
  121.         /* null terminated polys, double null at end */
  122. long toadTopVertices[] = {
  123.     2,1,3,0,    /* top */
  124.     3,1,4,0,
  125.     4,1,5,0,
  126.     5,1,6,0,
  127.     6,1,7,0,
  128.     7,1,8,0,
  129.     8,1,9,0,
  130.     9,1,2,0,
  131.     0,
  132. };
  133.  
  134. point toadLFLegPoints[] = {
  135.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  136.     {    0,  300,  400, },
  137.     { -275,  200,  275, },    /* elbow Top*/
  138.     { -400,  200,  280, },
  139.     { -380,  200,  260, },
  140.     { -405,  200,  240, },
  141.     { -265,  200,  270, },    /* elbow bottom */
  142.     {   40,  300,  390, },
  143. };
  144.  
  145. point toadRFLegPoints[] = {
  146.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  147.     {    0, -300,  400, },
  148.     { -275, -200,  275, },    /* elbow Top*/
  149.     { -400, -200,  280, },
  150.     { -380, -200,  260, },
  151.     { -405, -200,  240, },
  152.     { -265, -200,  270, },    /* elbow bottom */
  153.     {   40, -300,  390, },
  154. };
  155.  
  156. point toadLBLegPoints[] = {
  157.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  158.     {  700,  200,  275, },
  159.     {  800,  200,  280, },    /* elbow Top*/
  160.     {  720,  100,  260, },
  161.     {  750,  100,  240, },
  162.     {  730,  100,  270, },
  163.     {  910,  100,  390, },    /* elbow bottom */
  164.     {  815,  100,  580, },
  165.     {  900,   90,  650, },
  166. };
  167.  
  168.         /* null terminated polys, double null at end */
  169. long toadTop1Vertices[] = {
  170.     1,2,6,0,
  171.     2,3,4,0,
  172.     2,4,6,0,
  173.     4,5,6,0,
  174.     6,7,1,0,
  175.     0,
  176. };
  177. long toadTop2Vertices[] = {
  178.     1,2,6,0,
  179.     2,3,4,0,
  180.     2,4,6,0,
  181.     4,5,6,0,
  182.     6,7,1,0,
  183.     9,1,7,0,
  184.     9,7,8,0,
  185.     0,
  186. };
  187. long toadTop3Vertices[] = {
  188.     0,
  189. };
  190. long toadTop4Vertices[] = {
  191.     0,
  192. };
  193.         /* null terminated polys, double null at end */
  194. long toadBellyVertices[] = {
  195.     8,9,10,0,    /* Left side */
  196.     8,10,11,0,
  197.     8,11,12,0,
  198.     8,12,13,0,
  199.     8,13,7,0,
  200.     7,13,14,0,    /* tush */
  201.     6,7,14,0,
  202.     5,6,14,0,
  203.     14,4,5,0,    /* right side */
  204.     15,4,14,0,
  205.     16,4,15,0,
  206.     17,4,16,0,
  207.     3,4,17,0,
  208.     2,3,17,0,    /* snout */
  209.     10,2,17,0,
  210.     9,2,10,0,
  211.     10,17,16,0,    /* belly */
  212.     10,16,11,0,
  213.     11,16,15,0,
  214.     11,15,12,0,
  215.     12,15,14,0,
  216.     12,14,13,0,
  217.     0,
  218. };
  219.  
  220. model toadBody4 = {
  221.     0,            /* next model segment          */
  222.     0,            /* child model segments        */
  223.     0,                /* geometry compiled yet?      */
  224.     0,                /* compiled geometry object Id */
  225.     toadBodyPoints,        /* point dictionary            */
  226.     toadTop4Vertices,         /* polygon descriptions        */
  227.     { 0,0,200},            /* centroid                    */
  228.     EGG_COLOR,        /* color                       */
  229.     GUPPYBODY_TEXTURE,        /* texture                     */
  230.     /* TOADSTONE_COLOR,        /* color                       */
  231.     /* TOADSTONE_TEXTURE,        /* texture                     */
  232.     TRUE,            /* outlined                    */
  233.     { 0,0,0},            /* rotation                    */
  234.     { 0,0,0},            /* translation                 */
  235.     { 1.0,1.0,1.0},        /* scale                       */
  236.     1,                /* declasse               */
  237. };
  238.  
  239. model toadBody3 = {
  240.     &toadBody4,            /* next model segment          */
  241.     0,            /* child model segments        */
  242.     0,                /* geometry compiled yet?      */
  243.     0,                /* compiled geometry object Id */
  244.     toadBodyPoints,        /* point dictionary            */
  245.     toadTop3Vertices,         /* polygon descriptions        */
  246.     { 0,0,200},            /* centroid                    */
  247.     GUPPYIRIS_COLOR,        /* color                       */
  248.     GUPPYBODY_TEXTURE,        /* texture                     */
  249.     /* TOADSTONE_COLOR,        /* color                       */
  250.     /* TOADSTONE_TEXTURE,        /* texture                     */
  251.     TRUE,            /* outlined                    */
  252.     { 0,0,0},            /* rotation                    */
  253.     { 0,0,0},            /* translation                 */
  254.     { 1.0,1.0,1.0},        /* scale                       */
  255.     1,                /* declasse               */
  256. };
  257.  
  258. model toadBody2 = {
  259.     &toadBody3,            /* next model segment          */
  260.     0,            /* child model segments        */
  261.     0,                /* geometry compiled yet?      */
  262.     0,                /* compiled geometry object Id */
  263.     toadBodyPoints,        /* point dictionary            */
  264.     toadTop2Vertices,         /* polygon descriptions        */
  265.     { 0,0,200},            /* centroid                    */
  266.     GUPPYEYE_COLOR,        /* color                       */
  267.     GUPPYBODY_TEXTURE,        /* texture                     */
  268.     /* TOADSTONE_COLOR,        /* color                       */
  269.     /* TOADSTONE_TEXTURE,        /* texture                     */
  270.     TRUE,            /* outlined                    */
  271.     { 0,0,0},            /* rotation                    */
  272.     { 0,0,0},            /* translation                 */
  273.     { 1.0,1.0,1.0},        /* scale                       */
  274.     1,                /* declasse               */
  275. };
  276.  
  277. model toadBody1 = {
  278.     &toadBody2,            /* next model segment          */
  279.     0,            /* child model segments        */
  280.     0,                /* geometry compiled yet?      */
  281.     0,                /* compiled geometry object Id */
  282.     toadBodyPoints,        /* point dictionary            */
  283.     toadTop1Vertices,         /* polygon descriptions        */
  284.     { 0,0,200},            /* centroid                    */
  285.     GUPPYBODY_COLOR,        /* color                       */
  286.     GUPPYBODY_TEXTURE,        /* texture                     */
  287.     /* TOADSTONE_COLOR,        /* color                       */
  288.     /* TOADSTONE_TEXTURE,        /* texture                     */
  289.     TRUE,            /* outlined                    */
  290.     { 0,0,0},            /* rotation                    */
  291.     { 0,0,0},            /* translation                 */
  292.     { 1.0,1.0,1.0},        /* scale                       */
  293.     1,                /* declasse               */
  294. };
  295.  
  296. model toadBelly = {
  297.     &toadBody1,            /* next model segment          */
  298.     0,                /* child model segments        */
  299.     0,                /* geometry compiled yet?      */
  300.     0,                /* compiled geometry object Id */
  301.     toadBodyPoints,        /* point dictionary            */
  302.     toadBellyVertices,         /* polygon descriptions        */
  303.     { 0,0,200},            /* centroid                    */
  304.     MINNOWBODY_COLOR,        /* color                       */
  305.     GUPPYBODY_TEXTURE,        /* texture                     */
  306.     /* TOADSTONE_COLOR,        /* color                       */
  307.     /* TOADSTONE_TEXTURE,        /* texture                     */
  308.     0,            /* outlined                    */
  309.     { 0,0,0},            /* rotation                    */
  310.     { 0,0,0},            /* translation                 */
  311.     { 1.0,1.0,1.0},        /* scale                       */
  312.     1,                /* declasse               */
  313. };
  314.  
  315. model toadTop = {
  316.     &toadBelly,            /* next model segment          */
  317.     0,            /* child model segments        */
  318.     0,                /* geometry compiled yet?      */
  319.     0,                /* compiled geometry object Id */
  320.     toadBodyPoints,        /* point dictionary            */
  321.     toadTopVertices,         /* polygon descriptions        */
  322.     { 0,0,200},            /* centroid                    */
  323.     TOADTOP_COLOR,        /* color                       */
  324.     GUPPYBODY_TEXTURE,        /* texture                     */
  325.     /* TOADSTONE_COLOR,        /* color                       */
  326.     /* TOADSTONE_TEXTURE,        /* texture                     */
  327.     TRUE,            /* outlined                    */
  328.     { 0,0,0},            /* rotation                    */
  329.     { 0,0,0},            /* translation                 */
  330.     { 1.0,1.0,1.0},        /* scale                       */
  331.     1,                /* declasse               */
  332. };
  333.